import React from 'react'
import {
    SettingOutlined
} from '@ant-design/icons';
import type { MenuProps } from 'antd';
import { Dropdown } from 'antd';
import { useNavigate } from 'react-router-dom'
import styles from './index.module.scss'


export default function index() {
    const navigate = useNavigate()
    const handleSetting = (e: any) => {
        console.log('%c [ e ]-17', 'font-size:13px; background:pink; color:#bf2c9f;', e)
        if (e.key === '0') {
            localStorage.removeItem('token')
            navigate('/login', { replace: true })
        }
    }
    const items: MenuProps['items'] = [
        {
            label: 'login out',
            key: '0',
            onClick: (e) => handleSetting(e)
        }
    ]
    return (
        <div className={styles.headerRight}>
            <div className={styles.userInfo}>用户名</div>
            <div className={styles.icon}>
                <Dropdown menu={{ items }} trigger={['click']}>
                    <SettingOutlined />
                </Dropdown>
            </div>

        </div>
    )
}
